Test Quarantining
Once you've detected flaky tests, the next step is to fix them. However, you may have other priorities - here lies a dilemma. Flaky tests impact developer time, but there are other deliverables as well.
BuildPulse enables you to temporarily disable tests that flake beyond a configured threshold, to mitigate the impact of flaky tests. You can actually save the time consumed shown on our dashboard:
- Configure quarantine disruption percentage: Breached tests will automatically be marked as quarantined, and served via the Quarantine API. A test can also be manually quarantined on the Dashboard.
- Query the Quarantine API for flaky tests
- Disable/skip Tests
- Track & Re-enable tests (Jira/Linear/GitHub Issues)
Configure Thresholds
To configure your flaky test threshold:
Navigate to the BuildPulse Flaky Test Dashboard.
Click on top-right dropdown, and navigate to Settings > Repository Settings > Thresholds.
Set the disruption percentage which will determine quarantine status for a flaky test. There are a variety of thresholds that configure detection and quarantining behavior.
Git-Based Flaky Tests:
- Quarantine Minimum Count: Minimum number of results that have to be seen before a test is quarantined (default: 10, not configurable)
- Quarantine Disruption Percentage: If the disruption percentage exceeds this value, the test is quarantined (must be configured).
Statistical Flaky Tests:
- Detection Minimum Count: Minimum number of results that have to be seen before a test is quarantined. This can be configured (default: 10).
- Detection Disruption Percentage: If the test case failure rate exceeds this value, the test is marked statistically flaky. This can be configured (default: 30%).
- Quarantine Disruption Percentage: This inherits the same value is Git-Based Quarantine Disruption Percentage, and determins if the test is quarantined.
Query the Quarantine API
- Generate an API key at Settings > General > API Key.
- Query the API for flaky tests:
URL: https://api.buildpulse.io/v1/flaky/tests
Authorization: Authorization: Bearer ${BUILDPULSE_API_KEY}
Query Parameters:
repository
(required, orrepository_id
): The name of your repository/projectrepository_id
(required, orrepository
): The ID of your repository/project. You can find if you navigate to the repository > Flaky Tests tab > View Setup Guide (bottom left) > Other Providers > Step 2 (see Repository ID).quarantine
: Set tofalse
to return all flaky tests (default:true
)include
: Expand flaky test attributes. Supported values:tags, disruptiveness_ratio, nondeterministic_negative_result_count, quarantine_date, quarantine_type, time_consumed (microseconds), quarantined_by
. Example:include=tags,disruptiveness_ratio
after
: Pagination key. Value will benull
on the last page.
- Sample Response:
{
"count": 1,
"tests": [
{
"id": 434140152,
"name": "System Posts Lifecycle Basic posts flow can edit a post",
"suite": "rspec",
"class": "spec.system.posts_lifecycle_spec",
"file": "./spec/system/posts_lifecycle_spec.rb"
"disruptor_type": "default" # 'default' for git-based, 'statistical' for statistical flaky tests, 'disruptor_type_manual' for manually quarantined tests
}
],
"metadata": {
"after": null,
"limit": 25
}
}
Disable/Skip Tests
Please consult the documentation of your test framework for disabling individual tests.
Critical Tests
Test cases can be marked as 'critical', to prevent them from being quarantined automatically. Manual quarantining will still work, and tests that are already quarantined will remain so.
To mark a test case as 'critical', navigate to the test case page and toggle the checkbox in the test case metadata panel.
Track & Re-enable tests (Jira/Linear/GitHub Issues)
BuildPulse will preserve quarantined tests beyond the data retention period, and are tagged as 'quarantined' in the BuildPulse Flaky Test Dashboard.
BuildPulse will also automatically create issues in your project management system when a test is quarantined.
A test is re-enabled and resolved by either moving the created issue into the 'Done' column, or can also be manually resolved. This will remove the test from the quarantined list, and will no longer be ignored by your test framework.